package com.hb.trans.mvp.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.ctcnit.templatepro.global.MyGlideModule
import com.hb.trans.R
import com.hb.trans.bean.Article
import javax.inject.Inject

class HomeAdapter(layoutResId: Int) : BaseQuickAdapter<Article, BaseViewHolder>(layoutResId) {

    @Inject
    constructor() : this(R.layout.item_home_new)

    override fun convert(holder: BaseViewHolder, item: Article) {
        holder.apply {
            setText(R.id.tvNewTitle, item.title)
            setText(R.id.tvNewTime, item.create_time)
            MyGlideModule.load(
                mContext, item.head_pic, getView(R.id.ivNewPic), R.mipmap.ic_new_placeholder,
                R.mipmap.ic_new_placeholder
            )
        }
    }
}